<?php
App::uses('AppModel', 'Model');
/**
 * OptionType Model
 *
 * @property OptionValue $OptionValue
 */
class OptionType extends AppModel {

/**
 * Display field
 *
 * @var string
 */
	public $displayField = 'name';

	#OptionType status
	const hide = 0; #Save as hide
	const show = 1; #Save as show

/**
 * Validation rules
 *
 * @var array
 */
	public $validate = array(
		'name' => array(
			'notempty' => array(
				'rule' => array('notempty'),
				'message' => 'Required',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		'status' => array(
			'numeric' => array(
				'rule' => array('numeric'),
				//'message' => 'Your custom message here',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
	);

	//The Associations below have been created with all possible keys, those that are not needed can be removed

/**
 * hasMany associations
 *
 * @var array
 */
	public $hasMany = array(
		'OptionValues' => array(
			'className' => 'OptionValue',
			'foreignKey' => 'option_type_id',
			'dependent' => true,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		)
	);


	public $hasAndBelongsToMany = array(
    'Prototype' =>
        array(
            'className'              => 'Prototype',
            'joinTable'              => 'options_prototypes',
            'foreignKey'             => 'option_type_id',
            'associationForeignKey'  => 'prototype_id',
            'unique'                 => true,
            'conditions'             => '',
            'fields'                 => '',
            'order'                  => '',
            'limit'                  => '',
            'offset'                 => '',
            'finderQuery'            => '',
            'deleteQuery'            => '',
            'insertQuery'            => ''
        )
  );

}
